import axios from './axios'

export default getDatas = (obj) => {
  var data = {
    "jsonrpc": "2.0",
    "method": "item.get",
    "params": {
      "output": "extend",
      "hostids": obj.hostId,
      "search": obj.search,
      "sortfield": "name"
    },
    "auth": obj.auth,
    "id": obj.id
  }
  return new Promise((resolve, reject) => {
    axios.post('/zabbix/api_jsonrpc.php', data).then(
      res => {
        resolve(res.result);
      },
      err => {
        reject('获取数据失败，请检查网络状况，或稍后刷新页面..')
      }
    )
  })
}